<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>垂直水平居中</title>
    <style>
        /* .flex{
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100px;
            background: #f22;
        } */
        /* .flex-2{
            display: flex;
           height: 200px;
        } */
        /* .position-abs{
            position: absolute;
            left: 50%;
            top: 50%;
            margin-left: -100px;
            width: 200px;
        } */
        /* .position-revate{
             position: relative;

            height: 200px;
            width: 200px;
        } */

        /* .table-cell{
            display: table-cell;
            vertical-align: middle;
            width: 200px;
            height: 400px;
        } */
        /* .grid{
            display: grid;
            justify-content: center;
            align-items: center;
            height: 200px;
        } */
        /* .grid-to-child-auto{
            display: grid;
            height: 200px;
        } */
        .after-inline-block{
            height: 200px;
            width: 200px;
            text-align: center;
        }
        .after-inline-block:after{
            content: " ";
            line-height:200px
        }
    </style>
</head>
<body>
    <!-- <div class="flex">
        <div>垂直水平居中flex布局定高...</div>
    </div> -->
    <!-- <div class="flex-2">
        <div style="margin:auto">
            垂直水平居中flex 定高子元素设置margin:auto垂直水平居中....
        </div>

    </div> -->
    <!-- <div class="position-abs">
       position垂直水平居中...
    </div> -->
    <!-- <div class="position-revate">
        <div style=" left: 0%;
            top: 0%;
            bottom: 0;
            right: 0;position: absolute;width: 120px;height: 120px;margin: auto;background: #dff;">
    position垂直水平居中...
        </div>

    </div> -->
    <!-- <div class="table-cell">
        <div class="cell" style="    vertical-align: middle;
    margin: auto;
    text-align: center;">table-cell实现垂直居中</div>
    </div> -->

    <!-- <div class="grid">
        <div class="grid-child">grid实现垂直水平居中</div>
    </div> -->
    <!-- <div class="grid-to-child-auto">
        <div class="" style="margin:auto;">grid通过实现子元素的margin居中</div>
    </div> -->
    <div class="after-inline-block">
        <div style="display:inline-block">子元素after-inline-block实现垂直居中</div>
    </div>
</body>
</html>